Add color to log lines in UI for error and warnings based on keywords#39006
Conversation
dirrao
left a comment
There was a problem hiding this comment.
Nice feature. It will help to avoid the scanning the entire logs.
Does it work in case of bulky logs?
|
@dirrao This is to do string search and it has to process each line to apply color ansi codes. This is already done on whole log file to apply log level class based on info, error, warning etc and to build filters. I haven't benchmarked it but I don't see this adding much overhead. |
In case of data workloads the logs are too heavy on the client side. I believe test it once with bulky logs to see the obvious issues. |
|
cc: @jscheffl |
jscheffl
left a comment
There was a problem hiding this comment.
Thanks for the contribution. I really like this.
As I also contributed the ANSI coloring in 2.9 this is a good next logical extension.
Can you make a small performance check e.g. with 200k log lines, how long it rendern before and after this feature? Just to understand how performance is assumed to degrade?
Alongside some small considerations/comments for polishing. Small improvements but in general quite good already!
3a4d9d7 to
c56f50c
Compare
|
@dirrao @jscheffl Used below dag which generated around 30MB log file and the function call added around 15ms with total render time taking 9-10 seconds. I did it with dev builds using "yarn dev" since the function name was not searchable in production mode possibly due to no source mapping. Please let me know if I missed anything. Thanks Without patch With patch : |
jscheffl
left a comment
There was a problem hiding this comment.
Ah, anyway I assume in 80-90% probably the legacy log view will be gone in 2.10 (?) so if this is degrading might be acceptable.
|
The legacy log view doesn't have code changes to process every line. It just has the whole log as a single string so doing splitting and then adding ansi codes to join them back was more work that I left off since there is an issue to remove legacy log view especially with full-screen mode and other improvements being made to new UI. |
bbovenzi
left a comment
There was a problem hiding this comment.
Yeah, we'll remove the legacy task pages in 2.10 so this is good for me



closes: #37443
related: #37443
We have been using this feature in Airflow 2.3.4 in the legacy log page by applying regex against lines to apply color for them. It
received positive feedback from users since it's helpful in quickly identifying lines causing error while reading large log fies. This adds the feature to the new log tab in the grid. Users can set additional keywords besides common keywords like error and exception to highlight them since we found cases like "fail", "access denied", "missing" etc from trigger logs emitted by systems outside our Airflow that also were helpful in debugging but maybe not applicable to everyone. This also handles case where the log line already has an ansi code to wrap remaining part of the line with color to avoid conflict.
Error and exception lines in red color with bold style
Case where warn keyword is present but it has it's own ansi code to handle nested ansi codes